﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HRM.DAL.DAO;
using HRM.DAL.Gateway;

namespace HRM.BLL
{
    public class LeaveManager
    {
        LeaveGateway gateway=new LeaveGateway();
        public bool CofigureLeave(Leave leave)
        {
            if(gateway.AlreadySetup(leave))
            {
                return gateway.UpdateLeaveSetup(leave);
            }
            else
            {
                return gateway.ConfigureLeave(leave);
            }
        }
        public Leave GetLeaveSettings()
        {
            return gateway.GetLeaveSettings();
        }

        public bool ResetLeave(int key)
        {
            if(key==1)
            {
                Leave leave=new Leave();
                leave = gateway.GetLeaveSettings();
                return gateway.ResetLeave(leave);
            }
            else
            {
                //return gateway.ResetAndAddEarning();

            }
            return false;
        }
    }
}